package com.albaba.designpattern.chain_of_responsibility.text_003;

import com.albaba.designpattern.chain_of_responsibility.text_002.AuthInfo;
import com.albaba.designpattern.chain_of_responsibility.text_002.AuthService;
import org.slf4j.LoggerFactory;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Logger;

import static org.apache.logging.log4j.message.MapMessage.MapFormat.JSON;

/**
 * @author zx
 * @version 1.0
 * @description TODO
 * @date 2025/2/24 22:59
 */
public class Client {



    public static void main(String[] args) throws ParseException {
        AuthLink authLink = new Level1AuthLink("10000000001", "王工")
                .appendNext(new Level2AuthLink("10000000002", "张明"))
                .appendNext(new Level3AuthLink("10000000003", "李红"));

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date currentDate = sdf.parse("2022-11-18 22:59:59");


        AuthInfo authInfo = authLink.doAuth("研发牛马", "12312321", currentDate);
        System.out.println(authInfo);


        AuthService.auth("研发牛马", "12312321");
        AuthInfo result1 = authLink.doAuth("10000000001", "12312321", currentDate);
        System.out.println("测试结果：" + result1);

        AuthService.auth("10000000001", "12312321");
        AuthInfo result2 = authLink.doAuth("10000000002", "12312321", currentDate);
        System.out.println("测试结果：" + result2);

        AuthService.auth("10000000002", "12312321");
        AuthInfo result3 = authLink.doAuth("10000000003", "12312321", currentDate);
        System.out.println("测试结果：" + result3);




    }
}
